package Dao;

import java.sql.ResultSet;

import OracleHelper.OracleHelper;

public class SequenceDao {
	
	/*获取序列号构成主键课程ID*/
	public String getCourseResourceIDBySequence() {
		String id=null;
		String sql="select seq_ExcellentCourseId.nextval from sys.dual";
		ResultSet rs=OracleHelper.executeQuery(sql);
		try {
			while(rs.next()) {
				id=rs.getString(1);
			}
		}catch(Exception ex) {
			ex.printStackTrace();
		}
		return id;
		
	}
	
	/*获取序列号构成主键资源ID*/
	public String getLearningIDBySequence() {
		String id=null;
		String sql="select seq_LearningResourceId.nextval from sys.dual";
		ResultSet rs=OracleHelper.executeQuery(sql);
		try {
			while(rs.next()) {
				id=rs.getString(1);
			}
		}catch(Exception ex) {
			ex.printStackTrace();
		}
		return id;
		
	}
	
	/*获取序列号构成主键评论ID*/
	public String getCommentIDBySequence() {
		String id=null;
		String sql="select seq_CommentId.nextval from sys.dual";
		ResultSet rs=OracleHelper.executeQuery(sql);
		try {
			while(rs.next()) {
				id=rs.getString(1);
			}
		}catch(Exception ex) {
			ex.printStackTrace();
		}
		return id;
		
	}
	
	public static void main(String args[]) {
		System.out.print(new SequenceDao().getLearningIDBySequence());
	}

}
